package com.easymin.weixin.controller.web;


import com.easymin.weixin.common.DataForm;
import com.easymin.weixin.entity.AllowAccessIp;
import com.easymin.weixin.manager.AllowAccessIpManager;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("allowAccessIp")
public class AllowAccessIpController {

  @Autowired
  private AllowAccessIpManager allowAccessIpManager;

  @RequestMapping(value = {"", "/"}, method = RequestMethod.GET)
  public String index() {

    return "allowAccessIp/list";
  }

  @RequestMapping(value = {"/first"}, method = RequestMethod.GET)
  public @ResponseBody AllowAccessIp fetch() {

    return allowAccessIpManager.find();
  }

  @RequestMapping(value = {"", "/"}, method = RequestMethod.PATCH)
  public @ResponseBody DataForm<AllowAccessIp> update(@RequestParam("content") String content) {
    return allowAccessIpManager.update(content);
  }
}
